import { DynamicModule, Module } from '@nestjs/common'
import { GREETER_OPTIONS } from './greeter.constants'
import { GreeterService } from './greeter.service'

@Module({
  providers: [ GreeterService ],
})
export class GreeterModule {
  static forRoot(serviceName: string): DynamicModule {
    return {
      module: GreeterModule,
      providers: [ { provide: GREETER_OPTIONS, useValue: serviceName } ],
    }
  }
}
